define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user.cashout/index',
        add_url: 'user.cashout/add',
        edit_url: 'user.cashout/edit',
        delete_url: 'user.cashout/delete',
        export_url: 'user.cashout/export',
        modify_url: 'user.cashout/modify',
        adopt_url: 'user.cashout/adopt_url',
        reject_url: 'user.cashout/reject_url',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'nickname', title: '用户昵称', search: false},
                    {field: 'type', title: '类型',selectList: {1:'微信',2: '支付宝'}},
                    {field: 'account_number', title: '账号'},
                    {field: 'username', title: '真实姓名'},
                    {field: 'money', title: '提现金额', search: false},
                    {field: 'img', minWidth: 80, title: '收款码', search: false, templet: ea.table.image}, 
                    {field: 'status', title: '状态',selectList: {0:'待审核',1: '通过',2:'拒绝'}},
                    {field: 'reason', title: '拒绝原因', search: false},
                    {field: 'reamks', title: '备注', search: false},
                    {field: 'create_time', title: '申请时间', search: false},
                    {title: '操作', templet: ea.table.tool,operat:[
                        [
                            {
                                text: '通过',
                                title: '确定通过吗？',
                                url: init.adopt_url,
                                method: 'request',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success'
                            }
                       ],
                       [
                            {
                                text: '驳回',
                                url: init.reject_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-danger'
                            }
                        ]
                    ]},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        reject_url: function () {
            ea.listen();
        },
    };
    return Controller;
});